package com.yunyi.user.controller;

import com.google.common.collect.Lists;
import com.yunyi.model.announcement.Announcement;
import com.yunyi.model.announcement.SysNotice;
import com.yunyi.model.announcement.dto.AnnouncementDto;
import com.yunyi.response.CommonCode;
import com.yunyi.response.ResponseResult;
import com.yunyi.user.response.AnnouncementResponse;
import com.yunyi.user.service.AnnouncementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName Announcement
 * @Description 公告
 * @Author leizhang
 * Date 2021/8/27 2:28 下午
 * @Version 1.0
 **/
@RequestMapping("/announcementApi")
@RestController
public class AnnouncementController {

    private static Logger LOGGER = LoggerFactory.getLogger(AnnouncementController.class);
    @Autowired
    private AnnouncementService announcementService;
    /**
     * @Description : 公告信息查询
     * @Author : leizhang
     * @Date 11:22 下午 2021/8/27
     * @param
     * @return com.yunyi.response.ResponseResult
     **/
    @PostMapping("/getAnnouncement")
    public ResponseResult getAnnouncement() {
        try {
           return announcementService.getSysNotice(new SysNotice());
        }catch (Exception e) {
            LOGGER.error(e.getMessage(),e);
            return new AnnouncementResponse(CommonCode.FAIL,null);
        }
    }

}
